from appium import webdriver

from po.basepage import BasePage
from po.main_page import MainPage


class App(BasePage):
    def start(self):
        caps = {}
        caps["platformName"] = "Android"
        caps["deviceName"] = "wework"
        caps["appPackage"] = "com.tencent.wework"
        caps["appActivity"] = ".launch.LaunchSplashActivity"
        caps["noReset"] = "true"
        caps["skipServerInstallation"] = "true"
        self.driver = webdriver.Remote("http://127.0.0.1:4723/wd/hub",caps)
        self.driver.implicitly_wait(60)
        return self

    def stop(self):
        self.driver.quit()

    def restart(self):
        pass

    def goto_main(self):
        return MainPage(self.driver)
